package itdfq.ydd.Behavior_Patters.visitor;

/**
 * @Author GocChin
 * @Date 2021/5/25 17:07
 * @Blog: itdfq.com
 * @QQ: 909256107
 */
public class HomeAmmeterVisitor implements Visitor{
    public  double visit(AmmeterElement ammenter){
        double charge=0;
        double unitOne=0.6,unitTwo=1.05;
        int basic=6000;
        double n=ammenter.showElectricAmount();
        if(n<=basic){
            charge =n*unitOne;
        }else
        {
            charge=basic*unitOne+(n-basic)*unitTwo;
        }
        return charge;
    }
}
